package com.dqhl.community.util;

import com.dqhl.community.model.Community;

import java.util.Comparator;

/**
 * Created by cheng on 2016/9/8.
 * 根据拼音来排列ListView里面的数据类
 */
public class PinyinComparator implements Comparator<Community> {
    @Override
    public int compare(Community o1, Community o2) {
        if (o1.getSortLetters().equals("@")
                || o2.getSortLetters().equals("#")) {
            return -1;
        } else if (o1.getSortLetters().equals("#")
                || o2.getSortLetters().equals("@")) {
            return 1;
        } else {
            return o1.getSortLetters().compareTo(o2.getSortLetters());
        }
    }
}
